﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace EbnfStudio.Controls
{

    /// <summary>
    /// Simple textbox with preconfigured options
    /// </summary>
    class TextConsole : TextBox
    {
        // constructor
        public TextConsole()
        {
            this.AcceptsReturn = true;
            this.AcceptsTab = true;
            this.Dock = DockStyle.Fill;
            this.Font = new System.Drawing.Font("Courier New", 12, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.Location = new System.Drawing.Point(0, 0);
            this.Multiline = true;
            this.Name = "console";
            this.Size = new System.Drawing.Size(407, 335);
            this.TabIndex = 0;
            this.ReadOnly = true;
            this.BackColor = System.Drawing.Color.Black;
            this.ForeColor = System.Drawing.Color.LightGray;
            this.BorderStyle = System.Windows.Forms.BorderStyle.None;
        }


        /// <summary>
        /// Add text to the console control
        /// </summary>
        public override string Text
        {
            get
            {
                return base.Text;
            }
            set
            {
                base.Text = value + "\r\n";
                base.SelectionStart = base.TextLength;
                base.ScrollToCaret();
            }
        }
    }
}
